// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view')
}

export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: '/workplace',
    children: [
      {
        path: '/workplace',
        name: 'dashboard',
        component: () => import('@/views/dashboard/Workplace'),
        meta: { title: 'menu.dashboard', keepAlive: true, icon: bxAnaalyse, permission: [ 'dashboard' ] },
      },
      // {
      //   path: '/pipeline',
      //   name: 'pipeline',
      //   component: () => import('@/views/logstash/LogstashPipelineList'),
      //   meta: { title: 'Pipeline', icon: 'warning' }
      // },
      {
        path: '/pipeline/edit',
        name: 'pipeline-edit',
        hidden: true,
        component: () => import('@/views/logstash/LogstashPipelineEdit'),
        meta: { title: '编辑管道' }
      },
      {
        path: '/pipeline/view',
        name: 'pipeline-view',
        hidden: true,
        component: () => import('@/views/logstash/LogstashPipelineView'),
        meta: { title: '查看管道' }
      },
      // profile
      {
        path: '/data-control',
        name: 'Data-Control',
        component: RouteView,
        redirect: '/data-control/project',
        meta: { title: '控制', icon: 'profile', permission: [ 'profile' ] },
        children: [
          {
            path: '/data-control/project',
            name: 'project',
            component: () => import('@/views/data_control/ProjectList'),
            meta: { title: '项目管理', permission: [ 'profile' ] }
          },
          {
            path: '/data-control/project',
            name: 'project',
            component: () => import('@/views/data_control/UserList'),
            meta: { title: '用户管理', permission: [ 'profile' ] }
          },
        ]
      },
      {
        path: '/hosts',
        name: 'hosts',
        component: () => import('@/views/agent/AgentList'),
        meta: { title: '主机', icon: 'warning' }
      },
      {
        path: '/logstash',
        name: 'Logstash',
        component: () => import('@/views/logstash/LogstashPackage'),
        meta: { title: 'Logstash版本', icon: 'warning' }
      }
    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }

]
